<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="../include/admincontent.jsp" %>
<link rel="stylesheet" href="/resources/js/plugins/kindeditor-4.1.10/themes/default/default.css"/>
<div id="Content">

    <div>
    <form class="jobform" method="post" action="/ProjectJobTemplate/saveOrUpdate">
        <input type="hidden" name="id" id="templateId" value="${jobtemplate.id}"/>
        <input type="hidden" name="state" id="state" value="${jobtemplate.state}"/>
        <input type="hidden" name="createtime" id="createtime" value="${jobtemplate.createtime}"/>
        <input type="hidden" name="createuser" id="createuser" value="${jobtemplate.createuser}"/>
        <table class="treeTable inputform searchform">
            <thead>
            <tr>
                <td>模板名称<span class="required"> * </span></td>
                <td colspan="3">
                    <div><input type="text" name="tempname" id="tempname" datatype="*" nullmsg="模板名称不能为空！"/></div>
                </td>
                <td></td>
                <td style="text-align:right;">模板类型<span class="required"> * </span></td>
                <td>
                    <div style="width:200px;">
                        <select name="type" nullmsg="招聘人数不能为空！" id="type" datatype="*" >
                            <option value="">请选择</option>
                            <option value="A">社会招聘</option>
                            <option value="B">校园招聘</option>
                            <option value="C">中专招聘</option>
                            <option value="D">内部招聘</option>
                            <option value="E">驾驶员招聘</option>
                        </select>
                    </div>
                </td>
                <td></td>
            </tr>
            <tr>
                <td>岗位名称<span class="required"> * </span></td>
                <td colspan="3">
                    <div><input type="text" name="jobname" id="jobname" datatype="*" nullmsg="岗位不能为空！"/></div>
                </td>
                <td></td>
                <td style="text-align:right;">招聘人数<span class="required">*</span></td>
                <td>
                    <div style="width:200px;"><input type="text" name="zpcount" id="zpcount" datatype="zzs" nullmsg="招聘人数不能为空！"/>
                    </div>
                </td>
                <td>招聘人数用数字表示</td>
            </tr>
            <tr>
                <td>学历要求<span class="required"> * </span></td>
                <td colspan="3">
                    <div>
                        <select name="educode" id="educode" datatype="*" nullmsg="学历不能为空！">
                            <option value="0">不限</option>
                            <option value="10">博士研究生</option>
                            <option value="11">硕士研究生</option>
                            <option value="14">本科</option>
                            <option value="15">专科</option>
                            <option value="16">高职</option>
                            <option value="17">中专</option>
                            <option value="18">技校</option>
                            <option value="19">职高</option>
                            <option value="20">普高</option>
                            <option value="22">其它</option>
                        </select>
                        <input type="hidden" name="eduname" id="eduname"/>
                    </div>
                </td>
                <td></td>
                <td style="text-align:right;">专业要求<span class="required"> * </span></td>
                <td>
                    <div style="width:200px;">
                        <input type="text" name="major" id="major" datatype="*" nullmsg="所学专业不能为空！"/>
                    </div>
                </td>
                <td></td>
            </tr>
            <tr>
                <td width="120">年龄要求</td>
                <td width="80">
                    <div>
                        <input type="text" name="agef" id="agef"/>
                    </div>
                </td>
                <td width="20" style="text-align:center; ">-</td>
                <td width="80">
                    <div>
                        <input type="text" name="aget" id="aget" />
                    </div>
                </td>
                <td width="190" style="text-align:left;">请填写数字,无要求请留空</td>
                <td width="120" style="text-align:right;">性别要求<span class="required"> * </span></td>
                <td width="200">
                    <div>
                        <select name="gender" id="gender">
                            <option value="不限">不限</option>
                            <option value="男">男</option>
                            <option value="女">女</option>
                        </select>
                    </div>
                </td>
                <td></td>
            </tr>
            <tr>
                <td>身高要求</td>
                <td colspan="3">
                    <div><input type="text" name="height" id="height"/></div>
                </td>
                <td style="text-align:left;">填最低身高(单位:CM),无要求留空</td>
                <td style="text-align:right;">视力要求</td>
                <td>
                    <div><input type="text" name="vision" id="vision"/></div>
                </td>
                <td>无要求请留空</td>
            </tr>
            <tr>
                <td>工作年限</td>
                <td colspan="3">
                    <div><input type="text" name="workyear" id="workyear"/></div>
                </td>
                <td style="text-align:left;">填最低工龄(单位:年),无要求留空</td>
                <td style="text-align:right;">政治面貌</td>
                <td>
                    <div><input type="text" name="political" id="political"/></div>
                </td>
                <td>无要求请留空</td>
            </tr>
            <tr>
                <td>岗位类型<span class="required">*</span></td>
                <td colspan="3">
                    <select name="jobtype" id="jobtype" nullmsg="岗位类型不能为空！" datatype="*" >
                        <option value="">请选择</option>
                        <option value="技术岗">技术岗</option>
                        <option value="管理岗">管理岗</option>
                        <option value="后勤岗">后勤岗</option>
                    </select>
                </td>
                <td ></td>
                <td ></td>
                <td>

                </td>
                <td></td>
            </tr>
            <tr>
                <td>工作职责<span class="required"> * </span></td>
                <td colspan="7">
                    <div class="htmleditor">
                        <textarea id="workcont" name="workcont" datatype="*" nullmsg="工作职责不能为空！"
                                  style="width:737px;height:200px;"></textarea>
                    </div>
                </td>
            </tr>
            <tr>
                <td>工作经验<br/>及技能要求<span class="required"> * </span></td>
                <td colspan="7">
                    <div class="htmleditor">
                        <textarea id="workreq" name="workreq" datatype="*" nullmsg="工作经验及技能要求不能为空！"
                                  style="width:737px;height:200px;"></textarea>
                    </div>
                </td>
            </tr>
            <tr>
                <td></td>
                <td colspan="8">
                    <button type="submit" class="save">添 加</button>
                    <button type="reset" class="save">重 置</button>
                </td>
            </tr>
            </thead>
        </table>
    </form>
    </div>
</div>
<link rel="stylesheet" href="/resources/js/plugins/layui/css/layui.css" />
<script src="/resources/js/plugins/layui/layui.all.js" type="text/javascript"></script>
<script charset="utf-8" src="/resources/js/plugins/kindeditor-4.1.10/kindeditor-min.js"></script>
<script charset="utf-8" src="/resources/js/plugins/kindeditor-4.1.10/lang/zh_CN.js"></script>
<script type="text/javascript">

    layui.use(['form', 'layer'], function () {
        var $ = layui.$
            , layer = layui.layer
            , form = layui.form;

    });



    //实例化编辑器
    var szcont, szreq, nzcont, nzreq;
    KindEditor.ready(function (K) {
        szcont = K.create('#workcont', {
            resizeType: 1,
            items: ['removeformat', 'fullscreen'],
            afterBlur: function () {
                this.sync();
            }
        });
        szreq = K.create('#workreq', {
            resizeType: 1,
            items: ['removeformat', 'fullscreen'],
            afterBlur: function () {
                this.sync();
            }
        });
    });
    $(function () {
        var tempId=$('#templateId').val();
        if(!!tempId){
            $.get('/ProjectJobTemplate/getJobTemplate',{'tempid':tempId},function (data) {
                //console.log(data);
                layer.closeAll();
                if(data.state){
                    if(data.datas!=null){
                        job=data.datas;
                        $('#tempname').val(job.tempname);
                        $('#type').val(job.type);
                        $('#jobname').val(job.jobname);
                        $('#gender').val(job.gender);
                        $('#political').val(job.political);
                        $('#jobtype').val(job.jobtype);
                        $('#vision').val(job.vision);
                        $('#agef').val(job.agef);
                        $('#aget').val(job.aget);
                        $('#zpcount').val(job.zpcount);
                        $('#educode').val(job.educode);
                        $('#eduname').val(job.eduname);
                        $('#major').val(job.major);
                        $('#height').val(job.height);
                        $('#workyear').val(job.workyear);
                        szcont.html(job.workcont);
                        szreq.html(job.workreq);
                        szcont.sync();
                        szreq.sync();
                    }
                }else{
                    layer.alert(data.message);
                }
            },'JSON')
        }
    })

    $(document).ready(function () {

        $(".jobform").Validform({
            ajaxPost: true,
            datatype: {
                //大于等于0的整数
                "zzs": /^([1-9]\d{0,}|0)$/,
            },
            tiptype:function(msg){
                if(msg != "通过信息验证！")
                    layer.msg(msg);
            },
            callback: function (data) {
              //  $.Hidemsg();
                if (data.state) {
                    if(!!data.Message){
                        layer.msg(data.Message, {icon: 6});
                    }else{
                        layer.msg(data.message, {icon: 6});
                    }
                    if (!!parent.document.tablereload) {
                        parent.document.tablereload();
                    }
                    //parent.getList();
                    setTimeout(function(){
                        var index=parent.layer.getFrameIndex(window.name);
                        parent.layer.close(index);
                        },3000
                    );
                }
                else {
                    if(!!data.Message){
                        layer.msg(data.Message, {icon: 1});
                    }else{
                        layer.msg(data.message, {icon: 2});
                    }
                }
            }
        });
        $('input[name=eduname]').val($('select[name=educode]').find("option:selected").text());
        $('select[name=educode]').change(function () {
            $('input[name=eduname]').val($('select[name=educode]').find("option:selected").text());
        });

        $('#tempsTable tr').on('click',function(){trClikcHandle(this)});

        $('#istemplate input[type=radio]').change(function () {
            var istemp=$(this).val();
            if(istemp=="YES"){
                $('#tempsavetype').val("new")
            }else{
                $('#tempsavetype').val("");
            }
        });
    });



    $(function () {
        $('#flows_searchbtn').click();
    });
</script>
</body>
</html>